package org.firecloud.h5fun.controller.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.firecloud.h5fun.model.javabean.UserBean;

public class CreateProject extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		try {
			UserBean login_user = (UserBean) req.getSession().getAttribute("loginUser");
			if (login_user != null && login_user.isAdmin()) {
				req.getRequestDispatcher("jsp/page-create-project.jsp").forward(req, resp);
			} else {
				resp.sendRedirect("Login");
			}
		} catch (Exception e) {
			Logger.getRootLogger().error(e.toString());
			req.getRequestDispatcher("jsp/page-error.jsp").forward(req, resp);
		}
	}
}
